home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / CDTools / MUIRexx / demos / MUIRexxDir / defcomm.rexx < prev    next >
OS/2 REXX Batch file  |  1997-04-20  |  2KB  |  53 lines

  1. /*
  2.  
  3. Code:       defcomm.rexx
  4. Author:     Russell Leighton
  5. Revision:   11 Jan 1996
  6.  
  7. Comments:   This script tries to determine the file type of the named file.
  8. It executes a default command based on the file type.  It makes use of the
  9. datatype.library function 'examinedt()'.
  10.  
  11. Note that this script should be edited to taste (mine is undoubtedly
  12. different from yours).
  13.  
  14. */
  15. options results
  16.  
  17. parse arg portname' 'file
  18.  
  19. call examinedt(file,dt.,STEM)
  20.  
  21. type = upper(dt.DataType)
  22.  
  23. address value portname
  24. getvar screen
  25. pub = result
  26.  
  27. select
  28.     when pos('ASCII',type) = 1 then address command 'ced -pubscreen='pub' "'file'"'
  29.     when pos('JFIF',type) = 1 then address command 'sys:utilities/multiview PUBSCREEN 'pub' "'file'"'
  30.     when pos('GIF',type) = 1 then address command 'sys:utilities/multiview PUBSCREEN 'pub' "'file'"'
  31.     when pos('ILBM',type) = 1 then address command 'sys:utilities/multiview PUBSCREEN 'pub' "'file'"'
  32.     when pos('ANIM',type) = 1 then address command 'xanim "'file'"'
  33.     when pos('C-SOURCE',type) = 1 then address command 'ced -pubscreen='pub' "'file'"'
  34.     when pos('AMIGAGUIDE',type) = 1 then address command 'sys:utilities/multiview PUBSCREEN 'pub' "'file'"'
  35.     when pos('POSTSCRIPT',type) = 1 then address command 'sys:utilities/multiview PUBSCREEN 'pub' "'file'"'
  36.     when pos('LHA',type) = 1 then call 'muidir:lhalist' portname file
  37.     when pos('8SVX',type) = 1 then address command 'tools:music/Play16/Play16 "'file'"'
  38.     when pos('BINARY',type) = 1 then call findtool(file)
  39.     otherwise address command 'sys:utilities/multiview PUBSCREEN 'pub' "'file'"'
  40. end
  41. exit
  42.  
  43. findtool:
  44.     parse arg file
  45.     upfile = upper(file)
  46.     select
  47.         when index(upfile,'.DVI') ~= 0 then address command 'preview "'file'"'
  48.         when index(upfile,'.MOD') ~= 0 then call 'playmod "'file'"'
  49.         when index(upfile,'MOD.') ~= 0 then call 'playmod "'file'"'
  50.         otherwise address command 'sys:utilities/multiview PUBSCREEN 'pub' "'file'"'
  51.     end
  52. return
  53.